<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>管理后台</title>
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <link href="/favicon.ico" type="image/x-icon" rel="shortcut icon" />
    <!-- Bootstrap 3.3.4 -->
    <link href="/public/admin/css/bootstrap.min.css?v=3.3.5" rel="stylesheet">
    <link href="/public/admin/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
    <link href="/public/admin/css/animate.css" rel="stylesheet">
    <link href="/public/admin/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
    <link href="/public/admin/css/style.css?v=4.0.0" rel="stylesheet">
    <link href="/public/admin/css/ratuo.css" rel="stylesheet">

    <script src="/public/admin/js/jquery.min.js?v=2.1.4"></script>
    <script src="/public/admin/js/bootstrap.min.js?v=3.3.5"></script>
    <script src="/public/admin/js/common.js"></script>
    <script src="/public/admin/js/plugins/layer/layer.min.js"></script>
    <script src="/public/admin/js/myAjax.js"></script>
    <script src="/public/admin/js/jquery.validate.js"></script>

    <link href="/public/admin/css/plugins/iCheck/custom.css" rel="stylesheet">
    <script src="/public/admin/js/plugins/iCheck/icheck.min.js"></script>

    <script src="/public/admin/js/article.js"></script>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>{:lang('cert_list')}</h5>
                </div>
                <div class="ibox-content">
                    <div class="row">
                        <div class="col-xs-12">
                            <div class="box">
                                <div class="box-header">
                                    <div class="panel-body">
                                        <form id="formSearch" method="get" action="{:url('cert/certList')}" class="form-horizontal form-inline">
                                            <label class="control-label">{:lang('key_word')}：</label>
                                            <input type="text" placeholder="{:lang('key_word_title')}" name="keyword" id="keyword" value="{$keyword}" class="form-control">
                                            <button type="submit" style="margin-left:30px" class="btn btn-primary">{:lang('query')}</button>
                                            <button onclick="window.location.href=location.href;"  class="btn btn-primary " style="float: right; margin-top: 10px;margin-right:10px;"><i class="glyphicon glyphicon-refresh"></i>{:lang('refresh')}</button>
                                            <button onclick="openYemian('/index.php/Admin/Cert/cert',`{:lang('add')}`)" type="button" class="btn btn-primary" style="float: right;margin-right:10px; margin-top: 10px;"><i class="fa fa-plus"></i>{:lang('add')}</button>
                                        </form>
                                    </div>
                                </div>
                                <div class="box-body">
                                    <div class="row">
                                        <div class="col-sm-12">
                                            <div id="ajaxList">
                                                <form method="post" enctype="multipart/form-data" id="form-order">
                                                <table class="table table-bordered table-hover">
                                                    <thead>
                                                        <tr>
                                                            <th style="width: 1px;"><input type="checkbox" onclick="$('input[name*=\'ids\']').prop('checked', this.checked);"></th>
                                                            <th>{:lang('activity_id')}</th>
                                                            <th>{:lang('activity_title')}</th>
                                                            <th>{:lang('activity_background')}</th>
                                                            <th>{:lang('activity_cert')}</th>
                                                            <th>{:lang('activity_cert_mode')}</th>
                                                            <th>{:lang('activity_update')}</th>
                                                            <th>{:lang('operation')}</th>
                                                        </tr>
                                                    </thead>
                                                    <tbody id="ajaxList">
                                                        {if empty($list)}
                                                            <tr>
                                                                <td colspan="7" align="center">{:lang('no_data')}</td>
                                                            </tr>
                                                        {/if}
                                                        {foreach name="list" item="vo" key="k" }
                                                          <tr role="row">
                                                            <td><input type="checkbox" name="ids[]" value="{$vo.article_id}" onclick="attrBg(this)"></td>
                                                              <td>{$vo.id}</td>
                                                              <td>{$vo.title}</td>
                                                              <td>
                                                                  <img src="{$vo.bg_img}" width="50px">
                                                              </td>
                                                              <td>
                                                                  <img src="{$vo.cert_img}" width="50px">
                                                              </td>
                                                              <td>
                                                                  {if $vo.cert_type == 1}{:lang('type1')}{/if}
                                                                  {if $vo.cert_type == 2}{:lang('type2')}{/if}
                                                                  {if $vo.cert_type == 3}{:lang('type3')}{/if}
                                                                  {if $vo.cert_type == 4}{:lang('type4')}{/if}
                                                              </td>
                                                              <td>{$vo.updated_at}</td>
                                                            <td>
                                                                <a class="btn btn-primary" href="javascript:;" title="{:lang('edit')}" onclick="openYemian('/index.php/Admin/Cert/cert/act/edit/id/{$vo.id}',`{:lang('edit')}`)"><i class="fa fa-pencil"></i></a>
                                                                <a class="btn btn-primary" href="javascript:;" data-url="{$vo.url}" title="{:lang('copy_link')}" onclick="copyUrl(this)"><i class="fa fa-link"></i></a>
                                                                <button class="btn btn-primary" href="javascript:;" title="{:lang('link_QR')}" onclick="openCode('/index.php/Admin/Cert/qrCode/id/{$vo.id}',`{:lang('link_QR')}`)"><i class="fa fa-image"></i></button>
                                                                <a href="javascript:void(0)" data-toggle="tooltip" class="btn btn-info" data-original-title="{:lang('copy_activity')}" title="{:lang('copy_activity')}" onclick="copyarticle(this,`{:lang('are_copy_activity')}`,`{$vo.id}`,'/index.php/Admin/cert/certcopy')"><i class="fa fa-copy"></i></a>
                                                                {if !empty($vo.excel)}
                                                                <a href="javascript:void(0)" data-toggle="tooltip" class="btn btn-info" data-original-title="{:lang('download_cert')}" title="{:lang('download_cert')}" onclick="getCertZip(this,`{:lang('are_download_cert')}`,`{$vo.cert_file}`,'/index.php/Admin/cert/getCertZip')"><i class="fa fa-download"></i></a>
                                                                {/if}
                                                            </td>
                                                          </tr>
                                                        {/foreach}
                                                    </tbody>
                                                </table>
                                                </form>
                                                <div>
                                                    <div style="float:right;margin-top:-20px;" id="pagelist">{$page|raw}<span style="float:right;margin:25px">{$total}{:lang('line')}</span></div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<input id="handle_status" value="" hidden="hidden">
<input id="kind_id" value="0" hidden="hidden">
<script>
    function copyUrl(that) {
        var clipBoardContent = $(that).attr('data-url');
        let oInput = document.createElement('input');
        oInput.value = clipBoardContent;
        document.body.appendChild(oInput);
        oInput.select();
        document.execCommand("Copy");
        oInput.style.display = 'none';
        document.body.removeChild(oInput);
        window.alert("{:lang('copy_success')}")
    }

    function copyarticle(obj,name,id,url) {
        top.layer.confirm(name,{
            icon : 3,
            btn:["{:lang('sure')}","{:lang('cancel')}"],
        } , function(){
            $.ajax({
                url : url,
                type : "post",
                data : {id:id,act:'copy'},
                dataType : "json",
                success:function(data){
                    if (data.status == 0) {
                        top.layer.msg(data.message);
                    } else {
                        top.layer.msg(data.message,{time:2000},function(){
                            window.location.href = location.href;
                        });
                    }
                }
            });
        } , function(){
            layer.close(); //再执行关闭
        })
    }
    function getCertZip(obj,name,cert_file,url) {
        top.layer.confirm(name,{
            icon : 3,
            btn:["{:lang('sure')}","{:lang('cancel')}"],
        } , function(){
            $.ajax({
                url : url,
                type : "post",
                data : {cert_file:cert_file,act:'download'},
                dataType : "json",
                success:function(data){
                    if (data.status == 0) {
                        top.layer.msg(data.message);
                    } else {
                        top.layer.msg(data.message,{time:2000},function(){
                            window.location.href=data.file;
                        });
                    }
                }
            });
        } , function(){
            layer.close(); //再执行关闭
        })
    }
</script>

</body>

</html>
